{% extends "base.html" %}

{% block title %}
        主机配置
{% endblock %}

{% block content %}

<style>
	.table th, .table td {vertical-align:middle;}
</style>

<script type="text/javascript">
        function do_reset(url){
               if (confirm("确定执行么？"))
               {
                       window.location.href=url;
               }
        }
</script>

<div class="alert alert-info">
	<h2>选择要配置的主机</h2>
</div>

<!--
<div style="float:right; width:80px; margin-bottom: 20px;">
        <button class="btn btn-block btn-primary" type="button" onclick="window.location.href='/client/add/'">添加</button>
</div>
-->
<div>
<p>
	<table class="table table-bordered table-striped table-hover">
	<tr>
	<th>IP地址</th>
	<th>主机别名</th>
	<th>项目</th>
	<th>监控</th>
	<th colspan=3 width="20%">操作</th>
	</tr>
{% load key %}
{% for host in result %}
	<tr>
	<td>{{ host|key:'hostname' }}</td>
	<td>{{ host|key:'aliasname' }}</td>
	<td>{{ host|key:'project' }}</td>
	<td>{{ host|key:'monitor' }}</td>
	<td><button class="btn btn-block" type="button" onclick="window.location.href='/client/conf/edit/?host={{ host|key:'hostname' }}'">编辑</button></td>
	<td><button class="btn btn-block" type="button" onclick="window.location.href='/client/monitor/edit/?host={{ host|key:'hostname' }}'">监控配置</button></td>
        <td><button class="btn btn-block btn-danger" type="button" onclick="window.location.href='javascript:do_reset(\'/client/conf/del/?host={{ host|key:'hostname' }}\')'">删除</button></td>
	</tr>
{% endfor %}
	
	<tr>
		<td colspan=6></td>
		<td colspan=2><button class="btn btn-block btn-primary" type="button" onclick="window.location.href='/client/conf/add/'">添加主机</button></td>
	</tr>

	</table>
</p>



{% endblock %}
